from django import forms
from django.contrib.auth.forms import AuthenticationForm
from django.contrib.auth.forms import UserCreationForm
from .models import UserInfo

class LoginForm(AuthenticationForm):
    username = forms.CharField(label="用户名")
    password = forms.CharField(label="密码", widget=forms.PasswordInput)


class RegisterForm(UserCreationForm):
    phone_number = forms.CharField(max_length=15, required=True, help_text='请输入手机号')

    class Meta:
        model = UserInfo
        fields = ['username', 'phone_number', 'password1', 'password2']